<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>vuejs</title>
    <script src="vue.js"></script>
</head>
<body>
<div id="app">
    <parent-component>
        <child2-component></child2-component>
    </parent-component>

    <child-component></child-component>
</div>
</body>
<script>

    var Child2 = Vue.extend({
        template:'<p>This is an another child component!22222</p>'
    });

    var Child = Vue.extend({
        template: '<p>This is a child component!11111</p>'
    });

    var Parent = Vue.extend({
        // 在Parent组件内使用<child-component>标签
        template :'<p>This is a Parent component!00000</p><child-component></child-component>',
        components: {
            // 局部注册Child组件，该组件只能在Parent组件内使用
            'child-component': Child
        }
    });

    // 全局注册Parent组件
    Vue.component('parent-component', Parent);
    Vue.component('child2-component', Child2);

    new Vue({
        el: '#app'
    })

</script>
</html>